<!doctype html>
<html>
<head>
    <title></title>
    <link rel="stylesheet" type="text/css" href="<?php echo URLPRE;?>static/public/diy/editor.css" />
    <script type="text/javascript" src="<?php echo URLPRE;?>static/public/js/validate.js?v=1.0"></script>
    <script type="text/javascript" src="<?php echo URLPRE;?>static/public/js/ajaxForm.js?v=1.0"></script>
    <script type="text/javascript" src="<?php echo URLPRE;?>static/admin/js/common.js?newversion"></script>
    <script type="text/javascript" src="<?php echo URLPRE;?>static/public/diy/diy_edit.js"></script>
    <script type="text/javascript">
        var district_url = '<?php echo site_url('admin/api/city_fetch/?id=')?>';
        var distary = ['continent', 'country', 'province', 'city', 'area'];
        _showdistrict(distary, 0);
    </script>
</head>
<body>
<div class="wrap">
    <div class="table_full">
        <div class="h_a"><p>类型：目的地列表 </p></div>
        <form method="post" class="formvalidate" action="<?php echo $form_url;?>" onsubmit="return false">
            <table class="list tab_label" cellpadding="0" cellspacing="1" border="0" id="general_config">
                <tbody>
                <tr>
                    <th style="width:100px">目的地</th>
                    <td>
                        <div class="mb10">
                            <select name="t[continent][]" id="continent" onchange="_showdistrict(distary, 1)">
                                <option value="-1" did="-1">选择洲</option>
                            </select>
                            <select name="t[country][]" id="country" onchange="_showdistrict(distary, 2)">
                                <option value="-1" did="-1">选择国家</option>
                            </select>
                            <select name="t[province][]" id="province" onchange="_showdistrict(distary, 3)">
                                <option value="-1" did="-1">选择省</option>
                            </select>
                            <select name="t[city][]" id="city" onchange="_showdistrict(distary, 4)">
                                <option value="-1" did="-1">选择市</option>
                            </select>
                            <select name="t[area][]" id="area">
                                <option value="-1" did="-1">选择区/县</option>
                            </select>
                        </div>
                        <a class="btn_submit" href="javascript:void(0);" id="add-dist" onclick="add_dist(this);">增加目的地</a>
                        <a class="disabled" href="javascript:void(0);" id="remove-dist" onClick="del_dist(this);">移除目的地</a>
                    </td>
                </tr>
                <tr>
                    <th>更多(可不填)</th>
                    <td>
                        <p>链接名称：<input class="input rounded valid" type="text" name="e[name]" value="<?php echo $data['svalue']['e']['name']?>" /> <span class="g">如：更多>></span></p>
                        <p>链接地址：<input class="input rounded w350" type="text" name="e[link]" value="<?php echo $data['svalue']['e']['link']?>" /></p>
                        <p class="g">如：国内游：guoneiyou，周边游：zhoubianyou，出境游：chujingyou, 自助游：zizhu</p>
                        <div class="g">
                            链接地址如何获取？
                            在导航上或分类中鼠标移动到链接上，右击复制链接地址，然后将地址粘贴到这里。
                            <p class="ored">填写相对链接即可，如果链接中带域名，需要把域名删除。如：把<?php echo site_url();?>删除</p>
                        </div>
                    </td>
                </tr>
                <tr>
                    <th>&nbsp;</th>
                    <td>
                    <button type="submit" class="btn_submit">保存</button>
                    </td>
                </tr>
                </tbody>
            </table>
        </form>
    </div>
</div>
<?php
$t = @$data['svalue']['t'];
if($t){
    foreach ($t['area'] as $k => $v) {
        $row[$k]['area'] = $v;
        $row[$k]['city'] = $t['city'][$k];
        $row[$k]['province'] = $t['province'][$k];
        $row[$k]['country'] = $t['country'][$k];
        $row[$k]['continent'] = $t['continent'][$k];
        if($k>0){
            ?>
                <script type="text/javascript">
                sel = 1;
                $('#add-dist').trigger('click');
                sel = 0;
                </script>
            <?php
        }
        $dist = $row[$k];
        ?>
    <script type="text/javascript">
        _showdistrict(['continent'+dist, 'country'+dist, 'province'+dist, 'city'+dist, 'area'+dist], 0, null, [<?php echo implode(',', array($dist['continent'],$dist['country'],$dist['province'],$dist['city'],$dist['area']));?>]);
    </script>
    <?php
    }
}
?>
</body>
</html>